package ts.test.shizahn.shizhan2;

import ts.test.shizahn.shizhan2.impl.AddImpl;
import ts.test.shizahn.shizhan2.impl.ExceptImpl;
import ts.test.shizahn.shizhan2.impl.MultiplyImpl;
import ts.test.shizahn.shizhan2.impl.SubtractImpl;

public class MySqlCompute {
    /**
     * 创建Compute工厂类
     */
    public Compute getInstance(String key){
        switch (key){
            case "+":
                return new AddImpl();
            case "-":
                return new SubtractImpl();
            case "*":
                return new MultiplyImpl();
            case "/":
                return new ExceptImpl();
            default:
                return null;
        }
    }
}
